Namespace Data

    Module DataAccessHelper
        Public Function GetPrimaryKey(ByVal row As DataRow) As Object
            Dim prs As DataColumn() = row.Table.PrimaryKey
            Debug.Assert(prs.Length = 1, "The primary key is absent or complex")
            Return row(prs(0).Ordinal)
        End Function

        Public Function AreDataRowsSame(ByVal row1 As DataRow, ByVal row2 As DataRow)
            If Not (row1 Is row2) Then Return False
            Return GetPrimaryKey(row1).Equals(GetPrimaryKey(row2))
        End Function
    End Module

End Namespace
